/*    
    BibleNotebook - A bible reader software
    Copyright (C) 2014  Williams Fernando Lopez

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
 */

package com.simplebible.bible.objects;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Williams Lopez
 */
public class BookLazy extends Book{

    public BookLazy(String abreviation, String human, int caps) {
        chaptersCount = caps;
        setHumanName(human);
        setAbreviation(abreviation);
    }

    public BookLazy(String abreviation, String human, int caps, boolean createChapters) {
        chaptersCount = caps;

        setHumanName(human);
        setAbreviation(abreviation);

        if(createChapters){
            chapters = new ArrayList<Chapter>();
            for(int i=1;i<=caps;i++){
                Chapter c = new Chapter();
                c.setAbreviation(abreviation+"."+i);
                chapters.add(c);
            }
        }
    }

    @Override
    public List<Chapter> getChapters(){
        if (super.getChapters() == null) {
            chapters = new ArrayList<Chapter>();
            for (int i = 1; i <= chaptersCount; i++) {
                Chapter c = new Chapter();
                c.setAbreviation(getAbreviation() + "." + i);
                chapters.add(c);
            }
        }
        return chapters;
    }

}